clear all 
set more off
set matsize 800

use /Users/yasenov/Dropbox/data_dta/master.dta

tostring id grade year, replace
gen course = grade + " " + subject + " " + cohort
gen class = year + " " + course
gen studentxclass = id + " " + class
gen gradebook = year + grade + cohort
destring id grade year, replace

drop if substr(subject, 1, 2) == "it" | substr(subject, 1, 2) == "cs" 

gen malelate = male * late_start
gen maleteachermale = male * teacher_male

log using "C:\Users\Lester\Dropbox\logits", text replace

global controls order_ass num_month bulg male late_start teacher_male

*ologit marks male##late_start male##teacher_male $controls, vce(cluster class)
ologit marks malelate maleteachermale $controls, vce(cluster class)
margins, dydx(male) atmeans
margins, dydx(malelate) atmeans
margins, dydx(maleteachermale) atmeans

oprobit marks malelate maleteachermale $controls, vce(cluster class)
margins, dydx(male) atmeans
margins, dydx(malelate) atmeans
margins, dydx(maleteachermale) atmeans

/*
xi: oprobit marks malelate maleteachermale $controls i.class, vce(cluster class)
margins, dydx(male) atmeans
margins, dydx(malelate) atmeans
margins, dydx(maleteachermale) atmeans

log close
